home *** CD-ROM | disk | FTP | other *** search
/ Champak 125 / Vol 125 (Damaged).iso / games / rabbit_r.swf / scripts / __Packages / disney / rabbitRivalry / scroller / ScrollerPanel.as < prev    next >
Encoding:
Text File  |  2009-06-09  |  1.6 KB  |  63 lines

  1. class disney.rabbitRivalry.scroller.ScrollerPanel extends smashing.keithm.Renderable
  2. {
  3.    var __distRatio;
  4.    var __z;
  5.    var __currentAsset;
  6.    var mc;
  7.    var __mcs;
  8.    var __fastScale;
  9.    var z;
  10.    var scale;
  11.    var startScale;
  12.    var x;
  13.    var y;
  14.    var loop;
  15.    var DRAWTYPE = "bg";
  16.    var __DEF_ASSET = "_empty";
  17.    var CUSTOMDRAW = true;
  18.    var __DRAW_ON_SPAWN = true;
  19.    var __DEF_WIDTH = 800;
  20.    var __DEF_HEIGHT = 800;
  21.    var __USE_ACTUAL_DIMENSIONS = false;
  22.    function ScrollerPanel(owner, t_distance, asset)
  23.    {
  24.       super({x:0,y:0,owner:owner});
  25.       this.__distRatio = 1 - t_distance / 1000;
  26.       this.__z = 1;
  27.       this.__currentAsset = asset;
  28.    }
  29.    function onDraw(newmc)
  30.    {
  31.       super.onDraw(newmc);
  32.       this.mc._x = 0;
  33.       this.mc._y = 0;
  34.       this.mc.attachMovie(this.__currentAsset,"bg" + this.__z,this.__z);
  35.       this.mc.cacheAsBitmap = true;
  36.       this.__mcs = [this.mc];
  37.    }
  38.    function onErase()
  39.    {
  40.       trace("I should not be erasable");
  41.    }
  42.    function render(camera, dt)
  43.    {
  44.       this.__fastScale = camera.fl / (this.z - camera.z);
  45.       if(this.scale != this.__fastScale)
  46.       {
  47.          this.scale = this.__fastScale;
  48.          this.mc._xscale = this.mc._yscale = 100 * (1 + (this.scale - this.startScale));
  49.       }
  50.       this.mc._x = (this.x - camera.x) * this.scale + camera.sc.x;
  51.       this.mc._y = (this.y - camera.y) * this.scale + camera.sc.y;
  52.    }
  53.    function clear()
  54.    {
  55.       this.loop = this.__mcs.length;
  56.       while(this.loop--)
  57.       {
  58.          this.__mcs[this.loop].removeMovieClip();
  59.       }
  60.       this.__mcs = [];
  61.    }
  62. }
  63.